const bodyParser = (req, res, next) => {
    let str = ""
    let arr = {}
    req.on('data', (chunk) => {
        str += chunk
        str = str.split('&')
        for (let i = 0; i <= str.length - 1; i++) {
            let tt = str[i].split('=')
            arr[tt[0]] = tt[1]
        }
    })

    req.on('end', () => {
        req.body = arr
        next()
    })
}

module.exports = bodyParser
